<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="porezForm">


			<rich:panel>
				<f:facet name="header">Poreska tarifa</f:facet>

				<p>Unesite podatke o poreskoj tarifi</p>


				<div class="dialog"><a4j:outputPanel id="panel">

					<h:panelGrid columns="3" rowClasses="prop"
						columnClasses="name,value,errormsg">

						<h:outputLabel for="naziv">Naziv</h:outputLabel>
						<h:inputText id="naziv" required="true"
							requiredMessage="Unesite naziv" value="#{porez.naziv}" />
						 <rich:message for="naziv">
                         <f:facet name="passedMarker">
                            <img  src="#{request.contextPath}/img/passed.gif" /> 
                        </f:facet>
                        <f:facet name="errorMarker">
                            <img  src="#{request.contextPath}/img/errormsg.gif" />   
                        </f:facet></rich:message>
						<h:outputLabel for="akciza">Akciza %</h:outputLabel>
						<h:inputText id="akciza" required="true"
							requiredMessage="Unesite ukcizu" value="#{porez.akciza}" />
						 <rich:message for="akciza">
                         <f:facet name="passedMarker">
                            <img  src="#{request.contextPath}/img/passed.gif" /> 
                        </f:facet>
                        <f:facet name="errorMarker">
                            <img  src="#{request.contextPath}/img/errormsg.gif" />   
                        </f:facet></rich:message>

						<h:outputLabel for="iznosPoreza">Iznos poreza %</h:outputLabel>
						<h:inputText id="iznosPoreza" required="true"
							requiredMessage="Unesite iznos poreza"
							value="#{porez.iznosPoreza}" />
						 <rich:message for="iznosPoreza">
                         <f:facet name="passedMarker">
                            <img  src="#{request.contextPath}/img/passed.gif" /> 
                        </f:facet>
                        <f:facet name="errorMarker">
                            <img  src="#{request.contextPath}/img/errormsg.gif" />   
                        </f:facet></rich:message>


					</h:panelGrid>
				</a4j:outputPanel></div>
			</rich:panel>
			<s:div id="buttons" styleClass="actionButtons">
				<a4j:commandButton id="save" value="Save"
					rendered="#{porez.id==null}" action="#{porezPage.save}"
					reRender="table,buttons,panel" />

				<a4j:commandButton id="delete" value="Delete"
					rendered="#{porez.id!=null}" action="#{porezPage.delete}"
					reRender="table,buttons,panel" />

				<a4j:commandButton id="update" value="Update"
					rendered="#{porez.id!=null}" action="#{porezPage.update}"
					reRender="table,buttons,panel" />

				<s:button value="Cancel" id="cancel" action="#{porezPage.cancel}" />

			</s:div>
		</h:form>
		<h:form>
			<rich:panel>
				<f:facet name="header">Lista porez</f:facet>

				<rich:dataTable id="table" value="#{listPorez}" var="p">

					<rich:column>
						<f:facet name="header">Naziv</f:facet>
						<a4j:commandLink id="select" ajaxSingle="true" value="#{p.naziv}"
							action="#{porezPage.select}" reRender="table,buttons,panel" />
					</rich:column>

					<rich:column>
						<f:facet name="header">Akciza</f:facet>
                 #{p.akciza}
                </rich:column>

					<rich:column>
						<f:facet name="header">Iznos poreza</f:facet>
                 #{p.iznosPoreza}
                </rich:column>

				</rich:dataTable>


			</rich:panel>
		</h:form>
	</ui:define>
</ui:composition>
